home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / tools / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / rs6000 / sysv4.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-15  |  13.4 KB  |  415 lines

  1. /* Target definitions for GNU compiler for PowerPC running System V.4
  2.    Copyright (C) 1995, Free Software Foundation, Inc.
  3.    Contributed by Cygnus Support.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.  */
  21.  
  22. /* eABI local switches -- put here rather than eabi.h, so the switches
  23.    can be tested in macros.  */
  24.  
  25. #define    MASK_NO_BITFIELD_TYPE    0x40000000    /* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
  26. #define    MASK_STRICT_ALIGN    0x20000000    /* Set STRICT_ALIGNMENT to 1.  */
  27. #define MASK_RELOCATABLE    0x10000000    /* GOT pointers are PC relative */
  28. #define    MASK_NO_TRACEBACK    0x08000000    /* eliminate traceback words */
  29. #define MASK_LITTLE_ENDIAN    0x04000000    /* target is little endian */
  30. #define MASK_NO_TOC        0x02000000    /* do not use TOC for loading addresses */
  31.  
  32. #define    TARGET_NO_BITFIELD_TYPE    (target_flags & MASK_NO_BITFIELD_TYPE)
  33. #define TARGET_STRICT_ALIGN    (target_flags & MASK_STRICT_ALIGN)
  34. #define TARGET_RELOCATABLE    (target_flags & MASK_RELOCATABLE)
  35. #define TARGET_NO_TRACEBACK    (target_flags & MASK_NO_TRACEBACK)
  36. #define TARGET_LITTLE_ENDIAN    (target_flags & MASK_LITTLE_ENDIAN)
  37. #define TARGET_NO_TOC        (target_flags & MASK_NO_TOC)
  38.  
  39. #define    TARGET_BITFIELD_TYPE    (! TARGET_NO_BITFIELD_TYPE)
  40. #define    TARGET_TRACEBACK    (! TARGET_NO_TRACEBACK)
  41. #define TARGET_BIG_ENDIAN    (! TARGET_LITTLE_ENDIAN)
  42. #define TARGET_TOC        (! TARGET_NO_TOC)
  43.  
  44. #undef    SUBTARGET_SWITCHES
  45. #define SUBTARGET_SWITCHES                        \
  46.   { "bit-align",    -MASK_NO_BITFIELD_TYPE },            \
  47.   { "no-bit-align",     MASK_NO_BITFIELD_TYPE },            \
  48.   { "strict-align",     MASK_STRICT_ALIGN },                \
  49.   { "no-strict-align",    -MASK_STRICT_ALIGN },                \
  50.   { "relocatable",     MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
  51.   { "no-relocatable",    -MASK_RELOCATABLE },                \
  52.   { "traceback",    -MASK_NO_TRACEBACK },                \
  53.   { "no-traceback",     MASK_NO_TRACEBACK },                \
  54.   { "little-endian",     MASK_LITTLE_ENDIAN },                \
  55.   { "little",         MASK_LITTLE_ENDIAN },                \
  56.   { "big-endian",    -MASK_LITTLE_ENDIAN },                \
  57.   { "big",        -MASK_LITTLE_ENDIAN },                \
  58.   { "no-toc",         MASK_NO_TOC | MASK_MINIMAL_TOC },        \
  59.   { "toc",        -MASK_NO_TOC },
  60.  
  61. /* Sometimes certain combinations of command options do not make sense
  62.    on a particular target machine.  You can define a macro
  63.    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
  64.    defined, is executed once just after all the command options have
  65.    been parsed.
  66.  
  67.    The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
  68.    get control.  */
  69.  
  70. #define SUBTARGET_OVERRIDE_OPTIONS                    \
  71. do {                                    \
  72.   if (TARGET_RELOCATABLE && TARGET_NO_TOC)                \
  73.     {                                    \
  74.       target_flags &= ~ MASK_NO_TOC;                    \
  75.       error ("-mrelocatable and -mno-toc are incompatible.");        \
  76.     }                                    \
  77.                                     \
  78.   if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC)            \
  79.     {                                    \
  80.       target_flags |= MASK_MINIMAL_TOC;                    \
  81.       error ("-mrelocatable and -mno-minimal-toc are incompatible.");    \
  82.     }                                    \
  83.                                     \
  84.   if (TARGET_NO_TOC && !TARGET_MINIMAL_TOC)                \
  85.     {                                    \
  86.       target_flags |= MASK_MINIMAL_TOC;                    \
  87.       error ("-mno-toc and -mno-minimal-toc are incompatible.");    \
  88.     }                                    \
  89. } while (0)
  90.  
  91. #include "rs6000/powerpc.h"
  92.  
  93. /* System V.4 uses register 13 as a pointer to the small data area,
  94.    so it is not available to the normal user.  */
  95.  
  96. #undef    FIXED_R13
  97. #define FIXED_R13 1
  98.  
  99. /* Override default big endianism */
  100. #undef  BYTES_BIG_ENDIAN
  101. #undef  WORDS_BIG_ENDIAN
  102. #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
  103. #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
  104.  
  105. /* Don't generate XCOFF debugging information.  */
  106.  
  107. #undef XCOFF_DEBUGGING_INFO
  108.  
  109. /* Don't use the COFF object file format.  */
  110.  
  111. #undef OBJECT_FORMAT_COFF
  112.  
  113. /* The XCOFF support uses weird symbol suffixes, which we don't want
  114.    for ELF.  */
  115.  
  116. #undef RS6000_OUTPUT_BASENAME
  117. #define RS6000_OUTPUT_BASENAME(FILE, NAME) assemble_name (FILE, NAME)
  118.  
  119. /* Don't bother to output .extern pseudo-ops.  They are not needed by
  120.    ELF assemblers.  */
  121.  
  122. #undef ASM_OUTPUT_EXTERNAL
  123.  
  124. /* Undefine some things which are defined by the generic svr4.h.  */
  125.  
  126. #undef ASM_FILE_END
  127. #undef ASM_OUTPUT_EXTERNAL_LIBCALL
  128. #undef READONLY_DATA_SECTION
  129. #undef SELECT_SECTION
  130. #undef ASM_DECLARE_FUNCTION_NAME
  131.  
  132. /* Use the regular svr4 definitions.  */
  133.  
  134. #include "svr4.h"
  135.  
  136. /* Prefix and suffix to use to saving floating point */
  137. #undef    SAVE_FP_PREFIX
  138. #undef    SAVE_FP_SUFFIX
  139. #define    SAVE_FP_PREFIX "_savefpr_"
  140. #define SAVE_FP_SUFFIX "_l"
  141.  
  142. /* Prefix and suffix to use to restoring floating point */
  143. #undef    RESTORE_FP_PREFIX
  144. #undef    RESTORE_FP_SUFFIX
  145. #define    RESTORE_FP_PREFIX "_restfpr_"
  146. #define RESTORE_FP_SUFFIX "_l"
  147.  
  148. /* Type used for ptrdiff_t, as a string used in a declaration.  */
  149. #undef    PTRDIFF_TYPE
  150. #define PTRDIFF_TYPE "int"
  151.  
  152. /* Type used for wchar_t, as a string used in a declaration.  */
  153. #undef    WCHAR_TYPE
  154. #define WCHAR_TYPE "short unsigned int"
  155.  
  156. /* Width of wchar_t in bits.  */
  157. #undef    WCHAR_TYPE_SIZE
  158. #define WCHAR_TYPE_SIZE 16
  159.  
  160. /* Align stack to 16 byte boundaries */
  161. #undef    STACK_BOUNDARY
  162. #define    STACK_BOUNDARY    128
  163.  
  164. /* No data type wants to be aligned rounder than this.  */
  165. #undef    BIGGEST_ALIGNMENT
  166. #define BIGGEST_ALIGNMENT 128
  167.  
  168. /* Use ELF style section commands.  */
  169.  
  170. #undef TEXT_SECTION_ASM_OP
  171. #define TEXT_SECTION_ASM_OP    "\t.section\t\".text\""
  172.  
  173. #undef DATA_SECTION_ASM_OP
  174. #define DATA_SECTION_ASM_OP    "\t.section\t\".data\""
  175.  
  176. /* Besides the usual ELF sections, we need a toc section.  */
  177. #undef EXTRA_SECTIONS
  178. #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc
  179.  
  180. #undef EXTRA_SECTION_FUNCTIONS
  181. #define EXTRA_SECTION_FUNCTIONS                        \
  182.   CONST_SECTION_FUNCTION                        \
  183.   CTORS_SECTION_FUNCTION                        \
  184.   DTORS_SECTION_FUNCTION                        \
  185.   TOC_SECTION_FUNCTION
  186.  
  187. #define TOC_SECTION_FUNCTION                        \
  188. void                                    \
  189. toc_section ()                                \
  190. {                                    \
  191.   static int toc_initialized = 0;                    \
  192.                                     \
  193.   if (in_section != in_toc)                        \
  194.     {                                    \
  195.       if (! toc_initialized)                        \
  196.     {                                \
  197.       if (!TARGET_RELOCATABLE && !TARGET_NO_TOC)            \
  198.         fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);        \
  199.                                     \
  200.       if (TARGET_MINIMAL_TOC)                    \
  201.         {                                \
  202.           if (!TARGET_RELOCATABLE && !TARGET_NO_TOC)        \
  203.         {                            \
  204.           ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0);    \
  205.           fprintf (asm_out_file, "\t.tc ");            \
  206.           ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
  207.           ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
  208.           fprintf (asm_out_file, "\n");                \
  209.         }                            \
  210.                                     \
  211.           fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
  212.           ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
  213.           fprintf (asm_out_file, " = .+32768\n");            \
  214.         }                                \
  215.                                     \
  216.       toc_initialized = 1;                        \
  217.     }                                \
  218.                                     \
  219.       else                                \
  220.     fprintf (asm_out_file, "%s\n",                    \
  221.          (TARGET_MINIMAL_TOC                    \
  222.           ? MINIMAL_TOC_SECTION_ASM_OP                \
  223.           : TOC_SECTION_ASM_OP));                \
  224.                                     \
  225.       in_section = in_toc;                        \
  226.     }                                    \
  227. }
  228.  
  229. #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
  230. #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".got1\",\"aw\""
  231.  
  232. /* Use the TOC section for TOC entries.  */
  233.  
  234. #undef SELECT_RTX_SECTION
  235. #define SELECT_RTX_SECTION(MODE, X)        \
  236. { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X))    \
  237.     toc_section ();                \
  238.   else                        \
  239.     const_section ();                \
  240. }
  241.  
  242. /* These macros generate the special .type and .size directives which
  243.    are used to set the corresponding fields of the linker symbol table
  244.    entries in an ELF object file under SVR4.  These macros also output
  245.    the starting labels for the relevant functions/objects.  */
  246.  
  247. /* Write the extra assembler code needed to declare a function properly.
  248.    Some svr4 assemblers need to also have something extra said about the
  249.    function's return value.  We allow for that here.  */
  250.  
  251. extern void svr4_traceback ();
  252. extern int rs6000_pic_labelno;
  253.  
  254. #undef    ASM_DECLARE_FUNCTION_NAME
  255. #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)            \
  256.   do {                                    \
  257.     if (TARGET_RELOCATABLE && get_pool_size () != 0)            \
  258.       {                                    \
  259.     char buf[256];                            \
  260.                                     \
  261.     ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno);    \
  262.                                     \
  263.     ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1);            \
  264.     fprintf (FILE, (TARGET_POWERPC64) ? "\t.quad " : "\t.long ");    \
  265.     assemble_name (FILE, buf);                    \
  266.     putc ('-', FILE);                        \
  267.                                     \
  268.     ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);    \
  269.     assemble_name (FILE, buf);                    \
  270.     putc ('\n', FILE);                        \
  271.       }                                    \
  272.                                     \
  273.     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                \
  274.     assemble_name (FILE, NAME);                        \
  275.     putc (',', FILE);                            \
  276.     fprintf (FILE, TYPE_OPERAND_FMT, "function");            \
  277.     putc ('\n', FILE);                            \
  278.     if (TARGET_TRACEBACK)                        \
  279.       svr4_traceback (FILE, NAME, DECL);                \
  280.     ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
  281.     ASM_OUTPUT_LABEL(FILE, NAME);                    \
  282.   } while (0)
  283.  
  284. /* How to renumber registers for dbx and gdb.  */
  285.  
  286. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  287.  
  288. /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL.  */
  289.  
  290. #undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX
  291. #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)    \
  292.   fprintf (FILE, ".%s", PREFIX)
  293.  
  294. /* Pass -mppc to the assembler, since that is what powerpc.h currently
  295.    implies.  */
  296. #undef ASM_SPEC
  297. #define ASM_SPEC \
  298.   "-u \
  299. %{mcpu=601: -m601} %{mcpu=ppc601: -m601} %{mcpu=mpc601: -m601} \
  300. %{!mcpu=601: %{!mcpu=ppc601: %{!mcpu=mpc601: -mppc }}} \
  301. %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
  302. %{mrelocatable} \
  303. %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
  304.  
  305. /* This is the end of what might become sysv4.h.  */
  306.  
  307. /* Allow stabs and dwarf, prefer dwarf.  */
  308. #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
  309. #define    DBX_DEBUGGING_INFO
  310. #define    DWARF_DEBUGGING_INFO
  311.  
  312. /* This macro gets just the user-specified name
  313.    out of the string in a SYMBOL_REF.  Discard
  314.    a leading * */
  315. #undef  STRIP_NAME_ENCODING
  316. #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
  317.   (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
  318.  
  319. /* Like block addresses, stabs line numbers are relative to the
  320.    current function.  */
  321.  
  322. #undef  ASM_OUTPUT_SOURCE_LINE
  323. #define ASM_OUTPUT_SOURCE_LINE(file, line)                \
  324. do                                    \
  325.   {                                    \
  326.     static int sym_lineno = 1;                        \
  327.     char *_p;                                \
  328.     fprintf (file, "\t.stabn 68,0,%d,.LM%d-",                \
  329.          line, sym_lineno);                        \
  330.     STRIP_NAME_ENCODING (_p, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
  331.     assemble_name (file, _p);                        \
  332.     fprintf (file, "\n.LM%d:\n", sym_lineno);                \
  333.     sym_lineno += 1;                            \
  334.   }                                    \
  335. while (0)
  336.  
  337. /* But, to make this work, we have to output the stabs for the function
  338.    name *first*...  */
  339.  
  340. #define    DBX_FUNCTION_FIRST
  341.  
  342. /* This is the end of what might become sysv4dbx.h.  */
  343.  
  344. #undef TARGET_VERSION
  345. #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
  346.  
  347. #undef CPP_PREDEFINES
  348. #define CPP_PREDEFINES \
  349.   "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
  350.  
  351. /* Don't put -Y P,<path> for cross compilers */
  352. #undef LINK_SPEC
  353. #ifdef CROSS_COMPILE
  354. #define LINK_SPEC "\
  355. %{h*} %{V} %{v:%{!V:-V}} \
  356. %{b} %{Wl,*:%*} \
  357. %{static:-dn -Bstatic} \
  358. %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
  359. %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
  360. %{G:-G} \
  361. %{YP,*} \
  362. %{Qy:} %{!Qn:-Qy} \
  363. %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
  364. %{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc }"
  365. #else
  366.  
  367. #define LINK_SPEC "\
  368. %{h*} %{V} %{v:%{!V:-V}} \
  369. %{b} %{Wl,*:%*} \
  370. %{static:-dn -Bstatic} \
  371. %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
  372. %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
  373. %{G:-G} \
  374. %{YP,*} \
  375. %{!nostdlib: %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
  376.          %{!p:-Y P,/usr/ccs/lib:/usr/lib}}} \
  377. %{Qy:} %{!Qn:-Qy} \
  378. %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
  379. %{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc }"
  380. #endif /* CROSS_COMPILE */
  381.  
  382. #undef CPP_SPEC
  383. #define CPP_SPEC "\
  384. %{posix: -D_POSIX_SOURCE} \
  385. %{mrelocatable: -D_RELOCATABLE} \
  386. %{mlittle: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
  387. %{mlittle-endian: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
  388. %{!mlittle: %{!mlittle-endian: -D_BIG_ENDIAN -Amachine(bigendian)}} \
  389. %{!mcpu*: \
  390.   %{mpower: %{!mpower2: -D_ARCH_PWR}} \
  391.   %{mpower2: -D_ARCH_PWR2} \
  392.   %{mpowerpc*: -D_ARCH_PPC} \
  393.   %{mno-powerpc: %{!mpower: %{!mpower2: -D_ARCH_COM}}} \
  394.   %{!mno-powerpc: -D_ARCH_PPC}} \
  395. %{mcpu=common: -D_ARCH_COM} \
  396. %{mcpu=power: -D_ARCH_PWR} \
  397. %{mcpu=powerpc: -D_ARCH_PPC} \
  398. %{mcpu=rios: -D_ARCH_PWR} \
  399. %{mcpu=rios1: -D_ARCH_PWR} \
  400. %{mcpu=rios2: -D_ARCH_PWR2} \
  401. %{mcpu=rsc: -D_ARCH_PWR} \
  402. %{mcpu=rsc1: -D_ARCH_PWR} \
  403. %{mcpu=403: -D_ARCH_PPC} \
  404. %{mcpu=mpc403: -D_ARCH_PPC} \
  405. %{mcpu=ppc403: -D_ARCH_PPC} \
  406. %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
  407. %{mcpu=mpc601: -D_ARCH_PPC -D_ARCH_PWR} \
  408. %{mcpu=ppc601: -D_ARCH_PPC -D_ARCH_PWR} \
  409. %{mcpu=603: -D_ARCH_PPC} \
  410. %{mcpu=mpc603: -D_ARCH_PPC} \
  411. %{mcpu=ppc603: -D_ARCH_PPC} \
  412. %{mcpu=604: -D_ARCH_PPC} \
  413. %{mcpu=mpc604: -D_ARCH_PPC} \
  414. %{mcpu=ppc604: -D_ARCH_PPC}"
  415.